package jaran.Tomxk.reflect_practice_1;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppCore {
    public static void main(String[] args) throws Exception{
        Class<?> A = Class.forName("jaran.Tomxk.reflect_practice_1.CustomerService");
        Object o = A.newInstance();

        Field service = A.getDeclaredField("service");
        service.setAccessible(true);
        Class<?> B = Class.forName("jaran.Tomxk.reflect_practice_1.UserService");
        service.set(o, B.newInstance());


        Method say = A.getDeclaredMethod("say");
        say.invoke(o);


    }
}
